\hypertarget{main_8cpp}{
\section{main.cpp File Reference}
\label{main_8cpp}\index{main.cpp@{main.cpp}}
}


The main \char`\"{}runner\char`\"{} file for the overall Compiler Project.  


{\ttfamily \#include $<$string$>$}\par
{\ttfamily \#include $<$ctype.h$>$}\par
{\ttfamily \#include $<$iostream$>$}\par
{\ttfamily \#include $<$fstream$>$}\par
{\ttfamily \#include $<$istream$>$}\par
{\ttfamily \#include $<$ostream$>$}\par
{\ttfamily \#include $<$cstring$>$}\par
{\ttfamily \#include \char`\"{}admin.h\char`\"{}}\par
{\ttfamily \#include \char`\"{}token.h\char`\"{}}\par
{\ttfamily \#include \char`\"{}assembler.h\char`\"{}}\par
{\ttfamily \#include \char`\"{}interp.h\char`\"{}}\par
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{main_8cpp_a1ebfba6753dd5c09eef607b0199cfd90}{runAssembler} (\hyperlink{classAdmin}{Admin} $\ast$admin)
\begin{DoxyCompactList}\small\item\em Function prototypes. \item\end{DoxyCompactList}\item 
void \hyperlink{main_8cpp_a01f415a2e2d5ad0f3d38c5196eea64d5}{runInterpreter} (bool step)
\begin{DoxyCompactList}\small\item\em Main function to run our \hyperlink{classInterpreter}{Interpreter}. \item\end{DoxyCompactList}\item 
int \hyperlink{main_8cpp_a0ddf1224851353fc92bfbff6f499fa97}{main} (int argc, char $\ast$argv\mbox{[}$\,$\mbox{]})
\begin{DoxyCompactList}\small\item\em Argc and Argv for later expansion. \item\end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
The main \char`\"{}runner\char`\"{} file for the overall Compiler Project. Currently, we only employ a \hyperlink{classScanner}{Scanner} which constructs a Symbol Table. This is accomplished through an included Administration class.

We use a standard set of files and an Administration and \hyperlink{classToken}{Token} Classes to run the base \hyperlink{classScanner}{Scanner}.

We have a static text file containing our sample PL code in the Root directory. This code is then sent into a string which we forward to our constructors for the scanner and admin.

We use local file for now to speed up testing and debugging. At a later date, it will read it from the argc and argv vars.

This file has no associated header.

\begin{DoxyAuthor}{Author}
Jordan Peoples, Chad Klassen, Adam Shepley 
\end{DoxyAuthor}
\begin{DoxyDate}{Date}
January 9th to 31st, 2011 
\end{DoxyDate}


\subsection{Function Documentation}
\hypertarget{main_8cpp_a0ddf1224851353fc92bfbff6f499fa97}{
\index{main.cpp@{main.cpp}!main@{main}}
\index{main@{main}!main.cpp@{main.cpp}}
\subsubsection[{main}]{\setlength{\rightskip}{0pt plus 5cm}int main (int {\em argc}, \/  char $\ast$ {\em argv}\mbox{[}$\,$\mbox{]})}}
\label{main_8cpp_a0ddf1224851353fc92bfbff6f499fa97}


Argc and Argv for later expansion. 



Read the file to a stream, then send each line to a String. We append our own newline and attach this to our whole File string. Repeat until we reach the end of the file. This might have scaling issues.

We check to see if there was an input parameter, and use that as the filename We do NOT accept multiple inputs (yet?). Choose the first one if multiple detected. If none, then ask for a file name.

\hyperlink{classSet}{Set} the debug flag for ASM output if we see the -\/g flag.

We could incorporate an error class here, but for now, it is not necessary as this is not a compiler operation

We create our administration object with our file string. It then begins the Scanning process. We could also have some error handling here, but that is not required. \begin{DoxySeeAlso}{See also}
Admin()
\end{DoxySeeAlso}
\hyperlink{classAssembler}{Assembler} Part This is where our assembler is called. Only runs if no errors are discovered.

LAST MINUTE HACK JOB. 



References Admin::getErrorCount(), runAssembler(), runInterpreter(), and Admin::scan().

\hypertarget{main_8cpp_a1ebfba6753dd5c09eef607b0199cfd90}{
\index{main.cpp@{main.cpp}!runAssembler@{runAssembler}}
\index{runAssembler@{runAssembler}!main.cpp@{main.cpp}}
\subsubsection[{runAssembler}]{\setlength{\rightskip}{0pt plus 5cm}void runAssembler ({\bf Admin} $\ast$ {\em admin})}}
\label{main_8cpp_a1ebfba6753dd5c09eef607b0199cfd90}


Function prototypes. 

Operates the \hyperlink{classAssembler}{Assembler} component of the compiler.

Use this function with a corresponding completed \hyperlink{classParser}{Parser} code in order to run the \hyperlink{classAssembler}{Assembler} on it. The code is then sent to interpInput.itp 

References Assembler::firstPass(), Admin::getASM(), and Assembler::secondPass().

\hypertarget{main_8cpp_a01f415a2e2d5ad0f3d38c5196eea64d5}{
\index{main.cpp@{main.cpp}!runInterpreter@{runInterpreter}}
\index{runInterpreter@{runInterpreter}!main.cpp@{main.cpp}}
\subsubsection[{runInterpreter}]{\setlength{\rightskip}{0pt plus 5cm}void runInterpreter (bool {\em step})}}
\label{main_8cpp_a01f415a2e2d5ad0f3d38c5196eea64d5}


Main function to run our \hyperlink{classInterpreter}{Interpreter}. 

Use this function to run the \hyperlink{classInterpreter}{Interpreter} on assembled PL code. This assumes that the assembled PL interpreter code is present in a file called interpInput.itp. 